﻿using System.Reflection;
using Dsl.Ped.Framework.Helpers;
using Dsl.Ped.Framework.Members;

namespace Dsl.Ped.Framework.Extensions
{
    /// <summary>
    /// Extension methods for the <see cref="MemberInfo"/>
    /// </summary>
    public static class MemberInfoExtension
    {
        /// <summary>
        /// Convert the <see cref="MemberInfo"/> into the <see cref="Member"/>
        /// </summary>
        /// <param name="memberInfo"><see cref="MemberInfo"/> of a class member</param>
        /// <returns><see cref="Member"/> converted from the <see cref="memberInfo"/></returns>
        public static Member ConvertToMember(this MemberInfo memberInfo)
        {
            return MemberInfoHelper.ConvertToMember(memberInfo);
        }

        /// <summary>
        /// Convert the <see cref="PropertyInfo"/> into the <see cref="Member"/>
        /// </summary>
        /// <param name="propertyInfo"><see cref="PropertyInfo"/> of a class property</param>
        /// <returns><see cref="Member"/> converted from the <see cref="propertyInfo"/></returns>
        public static Member ConvertToMember(this PropertyInfo propertyInfo)
        {
            return MemberInfoHelper.ConvertToMember(propertyInfo);
        }
    }
}
